<%@ page language="java" pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<HTML>
<HEAD>
	<meta http-equiv="Content-Language" content="zh-cn">
  <meta content="multipart/form-data; charset=utf-8" />
	<LINK href="${pageContext.request.contextPath}/css/Style1.css" type="text/css" rel="stylesheet">
	<script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
	<!-- 引入自定义css文件 style.css -->
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css" />
</HEAD>

<body>
<!--  -->
<form id="userAction_save_do" name="Form1" method="post" enctype="multipart/form-data" action="${pageContext.request.contextPath}/admin/adminEditProduct.do">
	&nbsp;
	<table cellSpacing="1" cellPadding="5" width="100%" align="center" bgColor="#eeeeee" style="border: 1px solid #8ba7e3" border="0">
		<tr>
			<td class="ta_01" align="center" bgColor="#afd1f3" colSpan="4"
				height="26">
				<strong><STRONG>编辑商品</STRONG>
				</strong>
			</td>
		</tr>
				<tr>
				<input type="hidden" name="pid" value="${product.pid}" id="pid">
				<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
				商品名称：
			</td>
			<td class="ta_01" bgColor="#ffffff">
				<input type="text" name="pname" value="${product.pname}" id="pname" class="bg"/>
			</td>
			<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
				是否热门：
			</td>
			<td class="ta_01" bgColor="#ffffff"  >
				<select id="is_hot" name="is_hot">
				<c:if test="${product.is_hot==1}">
						<option value="1" selected="selected">是</option>
						<option value="0">否</option>
				</c:if>
				<c:if test="${product.is_hot!=1}">
					<option value="0" selected="selected">否</option>
					<option value="1">是</option>
				</c:if>
				</select>
			</td>
		</tr>
		<tr>
			<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
				市场价格：
			</td>
			<td class="ta_01" bgColor="#ffffff">
				<input type="text" name="market_price" value="${product.market_price}" id="market_price" class="bg"/>
			</td>
			<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
				商城价格：
			</td>
			<td class="ta_01" bgColor="#ffffff">
				<input type="text" name="shop_price" value="${product.shop_price}" id="shop_price" class="bg"/>
			</td>
		</tr>
		<tr>
			<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
				商品图片：
			</td>
			<td class="ta_01" bgColor="#ffffff" colspan="3">
				<img src="${pageContext.request.contextPath}/${product.pimage}" width="220px" height="220px">
				<input type="file"  id="pimage" name="pimage"/>

			</td>
		</tr>
		<tr>
			<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
				所属分类：
			</td>
			<td class="ta_01" bgColor="#ffffff" colspan="3">
				<select name="cid" id="cid">
					<c:forEach items="${categories}" var="c">
						<c:if test="${product.cid==c.cid}">
							<option selected value="${c.cid}">${c.cname}</option>
						</c:if>
						<c:if test="${product.cid!=c.cid}">
							<option value="${c.cid}" name="${c.cname}">${c.cname}</option>
						</c:if>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr>
			<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
				商品描述：
			</td>
			<td class="ta_01" bgColor="#ffffff" colspan="3">
				<textarea name="pdesc" rows="5" cols="30" id="pdesc">${product.pdesc}</textarea>
			</td>
		</tr>

		<tr>
			<td class="ta_01" style="WIDTH: 100%" align="center"
				bgColor="#f5fafe" colSpan="4">
				<button type="submit" id="submit" value="确定" class="button_ok">
					&#30830;&#23450;
				</button>

				<FONT face="宋体">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT>
				<button type="reset" value="重置" class="button_cancel">&#37325;&#32622;</button>

				<FONT face="宋体">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT>
				<INPUT class="button_ok" type="button" onclick="history.go(-1)" value="返回"/>
				<span id="Label1"></span>
			</td>
		</tr>
	</table>
	<%--<script>--%>
		<%--$("#submit").click = function () {--%>
			<%--submitP();--%>
        <%--}--%>

		<%--function submitP() {--%>
		  <%--var product={--%>
        <%--pid:$("#pid").val(),--%>
        <%--pname:$("#pname").val(),--%>
        <%--is_hot:$("#is_hot").val(),--%>
        <%--market_price:$("#market_price").val(),--%>
        <%--shop_price:$("#shop_price").val(),--%>
        <%--pimage:$("#pimage").val(),--%>
        <%--cid:$("#cid").val(),--%>
        <%--pdesc:$("#pdesc").val()--%>
      <%--};--%>
		    <%--$.ajax({--%>
				   <%--url:"/admin/adminEditProduct.do",--%>
				   <%--type:"post",--%>
				   <%--data: JSON.stringify(product),--%>
          <%--dataType:"json",--%>
          <%--contentType:'application/json;charset=UTF-8',--%>
				   <%--success:function (d) {--%>
					   <%--location.href="/admin/adminFindAllProduct.do";--%>
              <%--}--%>
				    <%--})--%>

          <%--}--%>
	<%--</script>--%>
</form>
</body>
</HTML>